package net.neptech.listener;

import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @Author Saya
 * @Date 2025/8/19 15:38
 * @Description TODO
 **/
@Slf4j
public class EventListenerStrategyFactory {
    private static final Map<String, EventListenerStrategy> STRATEGY_CONCURRENT_HASH_MAP = new ConcurrentHashMap<>();
    /**
     * 提供获取策略的方法
     */
    public static EventListenerStrategy getStrategy(String key) {
        return STRATEGY_CONCURRENT_HASH_MAP.get(key);
    }
    /**
     * 在Bean属性初始化后执行该方法
     */
    public static void register(String key, EventListenerStrategy nodeConditionHandler) {
        STRATEGY_CONCURRENT_HASH_MAP.put(key, nodeConditionHandler);
    }
}
